package com.selune.online.ordering.system.project.api.base.constant.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author xiaoyp
 * @date 2020/3/24
 * <p>
 * Description:
 */
public enum OrderStatusEnum {
	
	/**
	 * 0 - 新订单
	 * 1 - 已完成
	 * 2 - 已取消
	 */
	NEW_ORDER(0, "新订单"),
	FINISH_ORDER(1, "已完成"),
	CANCEL_ORDER(2, "已取消");
	
	private static final Map<Integer, OrderStatusEnum> MAP = new HashMap<>();
	private Integer code;
	private String msg;
	
	OrderStatusEnum(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	
	public Integer code() {
		return this.code;
	}
	
	public String msg() {
		return this.msg;
	}
	
	public static OrderStatusEnum get(Integer code) {
		return MAP.get(code);
	}
}
